<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
	<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<fmt:setBundle basename="i18n.com.common" var="common"/>
<html>
<head>
<link rel="icon" href="static/img/favicon.png" type="image/x-icon" />
<link rel="shortcut icon" href="static/img/favicon.png"	type="image/x-icon" />
<link rel="bookmark" href="static/img/favicon.png" type="image/x-icon" />
<link rel="stylesheet" type="text/css"	href="static/them/default/easyui.css">
<script type="text/javascript" src="static/js/jquery.min.js"></script>
<script type="text/javascript" src="static/js/jquery.easyui.min.js"></script>
<script type="text/javascript" src="static/js/locale/easyui-lang-zh_CN.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 
 
<title>通用权限管理平台</title>
</head>
<body class="easyui-layout" style="margin: 5px;padding: 5px;">
     
        <div data-options="region:'north'" style="height:60px"></div>
       
        <div data-options="region:'east',split:true,iconCls:'icon-ok'" title="<fmt:message key="func.menu" bundle="${common}"/>" class="easyui-accordion"  style="width:150px;">
        		<div title="测试功能" data-options="iconCls:'icon-ok'" style="overflow: auto;">
        		<span class="easyui-linkbutton"	onclick="addPanel('${pageContext.request.contextPath }/gos/company/index','公司管理')" style="width: 100%">公司管理</span>
        		<span class="easyui-linkbutton"	onclick="addPanel('${pageContext.request.contextPath }/test2.jsp','田间2菜单')" style="width: 100%">田间菜单</span>
        		<span class="easyui-linkbutton"	onclick="addPanel('${pageContext.request.contextPath }/test3.jsp','田间3菜单')" style="width: 100%">田间菜单</span>
        		</div>
        </div>
        <div data-options="region:'west',split:true" title="我的地盘" style="width:180px;">
        	<jsp:include page="left.jsp"></jsp:include>
        </div>
        <div data-options="region:'center'">     
        	     <div id="main_tabs" class="easyui-tabs" style="width:100%;height:100%;">
        	     	 <div title="main" style="padding:10px">
        	     			
        	     	 </div>
        	     </div>
        </div>
     <div data-options="region:'south',split:true" style="height:50px;"></div>
     
 <script type="text/javascript">
 
		function gos_close(targe) {
			$('#' + targe).window('close');
		}
		function gos_detail(twin,tdg,url,title){
			var node = $('#'+tdg).datagrid("getSelections");
			if (node.length != 1) {
				$.messager.alert(title, gos.tip.viewonlyone, 'warning');
				return;
			}
			var pk = node[0].id;			
			$('#' + twin).empty();
			$('#' + twin).window({
				href : url+'?pk='+pk,
				title : title,
				width : 600,
				height : 500,
				minimizable : false,
				modal : true
			});
			
		}
		function gos_search( ff,dg) {
			var data = $('#' + ff).serialize();
			var param = {};
			var arr = data.split("&");
			for (p in arr) {
				var dest = arr[p].split("=");
				var t = dest[0];
				var v = dest[1];
				if(t){
					param[t] = v;
				}
			}

			$('#' + dg).datagrid('load', param);
		}
		function gos_submit(targetWindow, targetForm,refreshDg,dgForm) {
			$.messager.progress();
			$('#' + targetForm).form(
					'submit',
					{onSubmit : function() {
							var isValid = $(this).form('validate');
							if (!isValid) {
								$.messager.progress('close');
							}
							return isValid;
						},
						success : function(data) {
							var result = $.parseJSON(data);
							$.messager.progress('close');	
							if(result.success){
								$('#' + targetWindow).window('close');
								$.messager.show({title:data.title,msg : data.content,showType : 'show'});
								gos_search(dgForm,refreshDg);
							}else{
								$.messager.alert(result.title, result.content,result.type);		
							}
						}

					});
		}
		function gos_add(windowDiv, url, title) {
			$('#' + windowDiv).empty();
			$('#' + windowDiv).window({
				href : url,
				title : title,
				width : 600,
				height : 500,
				minimizable : false,
				modal : true
			});
		}
		function gos_edit(windowDiv,dataGird,url,title){
			var node = $('#'+dataGird).datagrid("getSelections");
			if(node.length != 1 ){
				$.messager.alert(title, gos.tip.editonlyone, 'warning');
				return;
			}else{
				var pk = node[0].id;			
				$('#' + windowDiv).empty();
				$('#' + windowDiv).window({
					href : url+'?pk='+pk,
					title : title,
					width : 600,
					height : 500,
					minimizable : false,
					modal : true
				});
			}		
		}
 		function gos_del(dataGird,searchForm,url,title){
 			  var node = $('#'+dataGird).datagrid("getSelections");
 			   if (node.length > 0) {
 				$.messager.confirm(title, gos.tip.delconfirm, function(r) {
 					if (r) {
 						var ids = new Array();
 						for (var i = 0; i < node.length; i++) {
 							ids.push(node[i].id);
 						}
 						$.post(url, {'pk' : ids}, 
 							function(data) {
 								if (data.success) {
 									$.messager.show({title:data.title,msg:data.content,showType : 'show'});
 									gos_search(searchForm,dataGird);
 								} else {
 									$.messager.alert(title, data.content, data.type);
 								}
 							}, 'json');
 					}
 				});
 			} else {
 				$.messager.alert(title, tip.selected, 'warning');
 			}
 		}
		function addPanel(url, title) {
			if ($('#main_tabs').tabs('exists', title)) {
				$('#main_tabs').tabs('select', title);
			} else {
				$('#main_tabs').tabs('add', {
					title : title,				
					closable : true,
					href : url
				});
			}
		}
	</script>
    <div id="gos_win" style="margin: 0;"/>
    
</body>
</html>